import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-29
 * Time: 19:15
 */

/* 请在这里填写答案 */
interface Goods {
    public String getName();

    public double getPrice();
}

class Book implements Goods {
    private String name;
    private double price;

    public Book(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getPrice() {
        return price;
    }
}

class Drink implements Goods {
    private String name;
    private double price;

    public Drink(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getPrice() {
        return price;
    }

}

class ShopCar {
    private Goods[] goods;
    public static int num = 0;

    public ShopCar(int n) {
        goods = new Goods[n];
    }

    public void add(Goods A) {
        if (num<goods.length){
            goods[num]=A;
            num++;
            System.out.println("添加成功！");
        }
        else {
            System.out.println("添加失败！");
        }
    }

    public Goods[] getGoods() {
        return goods;
    }

    public void remove(int n){
        for (int i = n; i < num - 1; i++) {
            goods[i]=goods[i+1];
        }
        goods[num-1] = null;
        num--;
    }
    public double check() {
        double sum = 0;
        for (int i = 0; i < num; i++) {
            if(goods[i]!=null) {
                sum += goods[i].getPrice();
            }
        }
        return sum;
    }
}


public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        ShopCar sc = new ShopCar(n);
        sc.add(new Book("Java程序设计", 78.5));
        sc.add(new Book("图像处理", 44.5));
        sc.add(new Book("高等数学", 34.8));
        sc.add(new Drink("绿茶", 2.5));
        sc.add(new Drink("雪碧", 3.5));
        sc.add(new Drink("可乐", 5.5));
        sc.remove(3);
        for (int i = 0; i < sc.getGoods().length; i++) {
            if (sc.getGoods()[i] != null)
                System.out.println("商品名称：" + sc.getGoods()[i].getName() + "，价格：" + sc.getGoods()[i].getPrice());
        }
        System.out.println("结账：" + sc.check());
    }

}